package T01_test_all.test18_Phone;

import java.util.ArrayList;

/**
 *  查找手机中价格低于3000 的手机信息
 */
public class T1801_Phone_controls {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        T1801_Phone phone1 = new T1801_Phone("小米",1888);
        T1801_Phone phone2 = new T1801_Phone("华为",2888);
        T1801_Phone phone3 = new T1801_Phone("三星",3888);
        list.add(phone1);
        list.add(phone2);
        list.add(phone3);

        ArrayList<T1801_Phone> getList = getdayu3000(list);
        for (int i = 0; i < getList.size(); i++) {
            T1801_Phone newP = getList.get(i);
            System.out.println(newP.getBrand()+newP.getPrice());
        }
    }

    public static ArrayList<T1801_Phone> getdayu3000(ArrayList<T1801_Phone> list){
        ArrayList<T1801_Phone> newList = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            T1801_Phone ph = list.get(i);
            if(ph.getPrice() > 3000){
                newList.add(ph);
            }
        }
        return newList;
    }
}
